package com.pctx.bibaregisterlogin.controller;

import com.pctx.bibacommon.result.Result;
import com.pctx.bibaregisterlogin.service.LoginService;
import com.pctx.bibaregisterlogin.service.MyCenterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 */
@CrossOrigin
@RestController
@RequestMapping("/login")
public class LoginController {
    @Autowired
    private LoginService loginService;
    @Autowired
    private MyCenterService userService;
    @RequestMapping("/verifyLogin")
    public Result verifyLogin(@RequestParam("usernameOrMobile") String usernameOrMobile , @RequestParam("password") String password)throws Exception{
        //@RequestParam 必须传该参数，不然报错
        return loginService.verifyLogin(usernameOrMobile,password);
    }

    @RequestMapping("/updateUserPass")
    public Result updateUserPass(@RequestParam("mobile")String mobile, @RequestParam("password")String password)throws Exception{
        return loginService.changeUserPass(mobile,password);
    }

    @RequestMapping("/personalMessage")
    public Result personalMessage(@RequestParam("username")String username) throws Exception {
        return userService.personalMessage(username);
    }

    /*@RequestMapping("/companyMessage")
    public Result companyMessage(String uuid) throws Exception {
        return myCenterService.companyMessage(uuid);
    }*/
}
